package com.byl.modules.core.service.impl;

import com.byl.modules.core.bean.CustomerBean;
import com.byl.modules.core.dao.CustomerDao;
import com.byl.modules.core.service.CustomerService;
import com.byl.sdk.bean.ResultBean;
import com.byl.sdk.utils.PageMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service
public class CustomerServiceImpl implements CustomerService {

    @Autowired
    CustomerDao customerDao;

    @Override
    public int save(CustomerBean customerBean) {
        return customerDao.save(customerBean);

    }

    @Override
    public ResultBean query(Map map) {
        PageMap pageMap=new PageMap(map);
        //分页结果
        List list=customerDao.queryCustomer(pageMap);
        //总记录数
        int total=customerDao.queryCustomerCount(pageMap);
        return new ResultBean(pageMap.getPage(),pageMap.getPageSize(),total, list);

    }


    @Override
    public ResultBean queryWx(Map map) {
        PageMap pageMap=new PageMap(map);
         List list=customerDao.queryWxCustomer(pageMap);
         int total=customerDao.queryWxCustomerCount(pageMap);
        return new ResultBean(pageMap.getPage(),pageMap.getPageSize(),total, list);
    }

    @Override
    public int delete(String id) {

        return customerDao.delCustomer(id);
    }

    @Override
    public int receive(Map map) {
        return customerDao.receive(map);

    }
}
